﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DTO;
namespace DAO
{
    public class KHOIDAO
    {
        QUANLY_DIEMDataContext DB = new QUANLY_DIEMDataContext();
        //load danh sach khoi
        public List<KHOIDTO> DanhSachKhoi()
        {
            try
            {
                List<KHOIDTO> DSKhoi = new List<KHOIDTO>();
                var ds = from p in DB.KHOIs select p;
                foreach (var child in ds)
                {
                    KHOIDTO khoi = new KHOIDTO();
                    khoi.MAKH = child.MAKH;
                    khoi.TENKH = child.TENKH;
                    khoi.MAKH = child.MAKH;
                    DSKhoi.Add(khoi);
                }
                return DSKhoi;

            }
            catch
            {
                return null;
            }
        }
    }
}
